const BASE_URL = 'https://smmf.sdyilian.top/'   //后端给的url //  smmf.chentu.fun

// const BASE_URL = 'https://smmf.aqsuo.cn/'
export const myRequest = (options) => {
	
	return new Promise((resolve,reject)=> {
		console.log(uni.getStorageSync('user'));
		// let authtoken = uni.getStorageSync('authtoken')
		uni.request({
			url:BASE_URL + options.url,
			data:options.data || {},
			method:options.method || 'GET',
			header:{
			    // 'Content-type': 'application/json',
				'token':uni.getStorageSync('user').token,
				// 'userId':uni.getStorageSync('user_id')
			},
			dataType:'json',
			success:res => {
				//console.log(res,'返回结果');
				if(res.data.code == 401){
					
					// #ifdef MP-WEIXIN
						uni.navigateTo({
							url:'/pages/wxLogin'
						})
					// #endif
					
				}
				resolve(res)
			},
			fail:err => {
				// uni.showToast({
				// 	title:"请求接口失败",
				// })
				console.log('err',err)
				reject(err)
			}
		})
	}) 
}
